<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// Regression tests for crbug.com/936613

selection_test(
    [
      '<div contenteditable>',
        '|<span contenteditable="false">line 1</span>',
      '</div>'
    ].join(''),
    selection => selection.modify('move', 'right', 'character'),
    [
      '<div contenteditable>',
        '<span contenteditable="false">line 1</span>|',
      '</div>'
    ].join(''),
    'Move right over ineditable inline');

selection_test(
    [
      '<div contenteditable>',
        '|<span contenteditable="false">line 1</span>',
      '</div>',
      'some more content'
    ].join(''),
    selection => selection.modify('move', 'right', 'character'),
    [
      '<div contenteditable>',
        '<span contenteditable="false">line 1</span>|',
      '</div>',
      'some more content'
    ].join(''),
    'Move right over ineditable inline ignoring content outside editing host');

selection_test(
    [
      '<div contenteditable>',
        '|<span contenteditable="false">line 1</span><br>',
        'line 2',
      '</div>',
    ].join(''),
    selection => selection.modify('move', 'right', 'character'),
    [
      '<div contenteditable>',
        '<span contenteditable="false">line 1</span>|<br>',
        'line 2',
      '</div>',
    ].join(''),
    'Move right over ineditable inline with another editable line');

selection_test(
    [
      '<div contenteditable>',
        '|<span contenteditable="false">line 1</span>',
        '<div>line 2</div>',
      '</div>',
    ].join(''),
    selection => selection.modify('move', 'right', 'character'),
    [
      '<div contenteditable>',
        // TODO(editing-dev): "</span>|" seems to be a better result. The
        // current behavior might be an artifact of crrev.com/412925.
        '<span contenteditable="false">line 1</span>',
        '<div>|line 2</div>',
      '</div>'
    ].join(''),
    'Move right over ineditable inline with another editable block');
</script>
